package com.wss.merchant.controller;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wss.merchant.domain.*;
import com.wss.merchant.mapper.DlNewProductMapper;
import com.wss.merchant.mapper.DlNewStoreMapper;
import com.wss.merchant.service.DlNewCommunityManagerService;
import com.wss.merchant.service.DlNewProductService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.util.DigestUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.util.Date;
import java.util.List;
import java.util.Map;

@Slf4j
@Controller
public class TextController {
    @Resource
    private DlNewProductService dlNewProductService;
    @Resource
    private DlNewCommunityManagerService dlNewCommunityManagerService;
    @Resource
    private DlNewStoreMapper dlNewStoreMapper;

    @RequestMapping("/q")
    @ResponseBody
    public Page<Map> text(){
//        String time = String.valueOf(new Date().getTime());
//        DlNewCommunityManager byId = dlNewCommunityManagerService.getById(35);
//        log.info(byId.toString());

//        long addtime = byId.getAddtime();
//        log.info(String.valueOf(addtime));
//        long c = addtime * 1000;
//        DateTime date = DateUtil.date(c);



//        if(dlNewProductService.save(dlNewProduct) == true){
//            return new CommonResult(200,"数据添加成功");
//        }else {
//            return new CommonResult(200,"数据添加失败");
//        }

        Page<Map> dlNewStorePage = new Page<>(1,2);
        Page<Map> lq = dlNewStoreMapper.communityStore(dlNewStorePage, "路桥小商品市场");
//      dlNewStoreMapper.selectList(null);
//        Page<DlNewStore> dlNewStorePage1 = dlNewStoreMapper.selectPage(dlNewStorePage, null);


        return lq;
    }


}
